package org.seed.mybatis.core.ext;


import java.util.function.Function;


public class MapperRunner<Mapper> {

    private final Mapper mapper;



    public MapperRunner(Mapper mapper) {
        this.mapper = mapper;
    }


    public <R> R run(Function<Mapper, R> runner) {
        try {
            R ret = runner.apply(mapper);
            return ret;
        } catch (Throwable e) {
            throw new RuntimeException(e);
        } finally {
        }
    }

    public Mapper getMapper() {
        return mapper;
    }

}
